package o;

import android.annotation.TargetApi;
import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.SearchEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.Window.Callback;
import android.view.WindowManager.LayoutParams;
import android.view.accessibility.AccessibilityEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import o.axa.c;

public class axl implements axq {
    private Activity ˊ;
    private Callback ˋ;
    private View ˎ;
    private Drawable ˏ;
    private o.axx.d ॱ;

    static class d implements Callback {
        private o.axx.d ˊ;
        private Callback ˎ;

        d(o.axx.d dVar, Callback callback) {
            this.ˊ = dVar;
            this.ˎ = callback;
        }

        public boolean dispatchKeyEvent(KeyEvent keyEvent) {
            if (keyEvent.getAction() == 1 && this.ˊ.ॱ(keyEvent.getKeyCode(), keyEvent)) {
                return true;
            }
            return this.ˎ.dispatchKeyEvent(keyEvent);
        }

        public boolean dispatchKeyShortcutEvent(KeyEvent keyEvent) {
            return this.ˎ.dispatchKeyShortcutEvent(keyEvent);
        }

        public boolean dispatchTouchEvent(MotionEvent motionEvent) {
            return this.ˎ.dispatchTouchEvent(motionEvent);
        }

        public boolean dispatchTrackballEvent(MotionEvent motionEvent) {
            return this.ˎ.dispatchTrackballEvent(motionEvent);
        }

        public boolean dispatchGenericMotionEvent(MotionEvent motionEvent) {
            return this.ˎ.dispatchGenericMotionEvent(motionEvent);
        }

        public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
            return this.ˎ.dispatchPopulateAccessibilityEvent(accessibilityEvent);
        }

        @Nullable
        public View onCreatePanelView(int i) {
            return this.ˎ.onCreatePanelView(i);
        }

        public boolean onCreatePanelMenu(int i, @NonNull Menu menu) {
            return this.ˎ.onCreatePanelMenu(i, menu);
        }

        public boolean onPreparePanel(int i, @Nullable View view, @NonNull Menu menu) {
            return this.ˎ.onPreparePanel(i, view, menu);
        }

        public boolean onMenuOpened(int i, @NonNull Menu menu) {
            return this.ˎ.onMenuOpened(i, menu);
        }

        public boolean onMenuItemSelected(int i, @NonNull MenuItem menuItem) {
            return this.ˎ.onMenuItemSelected(i, menuItem);
        }

        public void onWindowAttributesChanged(LayoutParams layoutParams) {
            this.ˎ.onWindowAttributesChanged(layoutParams);
        }

        public void onContentChanged() {
            this.ˎ.onContentChanged();
        }

        public void onWindowFocusChanged(boolean z) {
            this.ˎ.onWindowFocusChanged(z);
        }

        public void onAttachedToWindow() {
            this.ˎ.onAttachedToWindow();
        }

        public void onDetachedFromWindow() {
            this.ˎ.onDetachedFromWindow();
        }

        public void onPanelClosed(int i, @NonNull Menu menu) {
            this.ˎ.onPanelClosed(i, menu);
        }

        public boolean onSearchRequested() {
            return this.ˎ.onSearchRequested();
        }

        @TargetApi(23)
        public boolean onSearchRequested(SearchEvent searchEvent) {
            return this.ˎ.onSearchRequested(searchEvent);
        }

        @Nullable
        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
            return this.ˎ.onWindowStartingActionMode(callback);
        }

        @TargetApi(23)
        @Nullable
        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i) {
            return this.ˎ.onWindowStartingActionMode(callback, i);
        }

        public void onActionModeStarted(ActionMode actionMode) {
            this.ˎ.onActionModeStarted(actionMode);
        }

        public void onActionModeFinished(ActionMode actionMode) {
            this.ˎ.onActionModeFinished(actionMode);
        }
    }

    axl(Activity activity, o.axx.d dVar) {
        this.ˊ = activity;
        this.ॱ = dVar;
    }

    public void ॱ(@NonNull View view) {
        this.ˊ.addContentView(view, new ViewGroup.LayoutParams(-1, -1));
        view.setBackgroundColor(this.ˊ.getResources().getColor(c.ˏ));
        this.ˎ = view;
        view.post(new axk(this));
    }

    private /* synthetic */ void ˋ() {
        this.ˏ = getWindow().getDecorView().getBackground();
        getWindow().getDecorView().setBackground(new ColorDrawable(this.ˊ.getResources().getColor(c.ˏ)));
        this.ˋ = getWindow().getCallback();
        if (this.ॱ != null) {
            getWindow().setCallback(new d(this.ॱ, this.ˊ));
        }
    }

    public void dismiss() {
        if (this.ˎ != null && (this.ˎ.getParent() instanceof ViewGroup)) {
            ((ViewGroup) this.ˎ.getParent()).removeView(this.ˎ);
        }
        getWindow().getDecorView().setBackground(this.ˏ);
        this.ˏ = null;
        getWindow().setCallback(this.ˋ);
        this.ˋ = null;
    }

    public Window getWindow() {
        return this.ˊ.getWindow();
    }
}
